<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<h3><spring:message code="label.title"/></h3>
<form:form method="post" action="add.action" commandName="user">
    <table>
    <tr>
        <td><form:label path="userName"><spring:message code="label.firstname"/></form:label></td>
        <td><form:input path="userName" /></td> 
    </tr>
    <tr>
        <td><form:label path="realName"><spring:message code="label.firstname"/></form:label></td>
        <td><form:input path="realName" /></td> 
    </tr>
    <tr>
        <td><form:label path="password"><spring:message code="label.firstname"/></form:label></td>
        <td><form:input path="password" /></td>
    </tr>
    <tr>
        <td colspan="2">
            <input type="submit" value="<spring:message code="label.addcontact"/>"/>
        </td>
    </tr>
</table>  
</form:form>
 
     
<h3>Users</h3>
<c:if  test="${!empty userList}">
<table class="data" style="border:1px solid #ccc">
<tr>
    <th>username</th>
    <th>realname</th>
    <th>password</th>
    <th>&nbsp;</th>
</tr>
<c:forEach items="${userList}" var="user">
    <tr>
        <td>${user.userName}</td>
        <td>${user.realName}</td>
        <td>${user.password}</td>
        <td><a href="delete/${user.userName}.action">delete</a></td>
    </tr>
</c:forEach>
</table>
</c:if>
</body>
</html>